/*
 * Germinus
 */
package org.germinus.telcoblocks.infraestructuras.diagram.rcp.providers;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
import org.eclipse.gmf.runtime.common.core.service.IOperation;
import org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserProvider;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
import org.eclipse.gmf.runtime.notation.View;
import org.germinus.telcoblocks.TelcoblocksPackage;
import org.germinus.telcoblocks.infraestructuras.diagram.rcp.edit.parts.Centralita_VOIPIPEditPart;
import org.germinus.telcoblocks.infraestructuras.diagram.rcp.edit.parts.EnlaceComentarioEditPart;
import org.germinus.telcoblocks.infraestructuras.diagram.rcp.edit.parts.MediaServerIPEditPart;
import org.germinus.telcoblocks.infraestructuras.diagram.rcp.edit.parts.Servidor_APP_SIPIPEditPart;
import org.germinus.telcoblocks.infraestructuras.diagram.rcp.edit.parts.Servidor_VOIPIPEditPart;
import org.germinus.telcoblocks.infraestructuras.diagram.rcp.edit.parts.SoftPhone_VOIPIDEditPart;
import org.germinus.telcoblocks.infraestructuras.diagram.rcp.edit.parts.Telefono_VOIPIDEditPart;
import org.germinus.telcoblocks.infraestructuras.diagram.rcp.parsers.MessageFormatParser;
import org.germinus.telcoblocks.infraestructuras.diagram.rcp.part.TelcoblocksVisualIDRegistry;

/**
 * @generated
 */
public class TelcoblocksParserProvider extends AbstractProvider implements
		IParserProvider {

	/**
	 * @generated
	 */
	private IParser softPhone_VOIPID_5001Parser;

	/**
	 * @generated
	 */
	private IParser getSoftPhone_VOIPID_5001Parser() {
		if (softPhone_VOIPID_5001Parser == null) {
			softPhone_VOIPID_5001Parser = createSoftPhone_VOIPID_5001Parser();
		}
		return softPhone_VOIPID_5001Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createSoftPhone_VOIPID_5001Parser() {
		EAttribute[] features = new EAttribute[] { TelcoblocksPackage.eINSTANCE
				.getTerminal_ID(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser servidor_VOIPIP_5002Parser;

	/**
	 * @generated
	 */
	private IParser getServidor_VOIPIP_5002Parser() {
		if (servidor_VOIPIP_5002Parser == null) {
			servidor_VOIPIP_5002Parser = createServidor_VOIPIP_5002Parser();
		}
		return servidor_VOIPIP_5002Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createServidor_VOIPIP_5002Parser() {
		EAttribute[] features = new EAttribute[] { TelcoblocksPackage.eINSTANCE
				.getServidor_IP(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser mediaServerIP_5003Parser;

	/**
	 * @generated
	 */
	private IParser getMediaServerIP_5003Parser() {
		if (mediaServerIP_5003Parser == null) {
			mediaServerIP_5003Parser = createMediaServerIP_5003Parser();
		}
		return mediaServerIP_5003Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createMediaServerIP_5003Parser() {
		EAttribute[] features = new EAttribute[] { TelcoblocksPackage.eINSTANCE
				.getServidor_IP(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser servidor_APP_SIPIP_5004Parser;

	/**
	 * @generated
	 */
	private IParser getServidor_APP_SIPIP_5004Parser() {
		if (servidor_APP_SIPIP_5004Parser == null) {
			servidor_APP_SIPIP_5004Parser = createServidor_APP_SIPIP_5004Parser();
		}
		return servidor_APP_SIPIP_5004Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createServidor_APP_SIPIP_5004Parser() {
		EAttribute[] features = new EAttribute[] { TelcoblocksPackage.eINSTANCE
				.getServidor_IP(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser centralita_VOIPIP_5005Parser;

	/**
	 * @generated
	 */
	private IParser getCentralita_VOIPIP_5005Parser() {
		if (centralita_VOIPIP_5005Parser == null) {
			centralita_VOIPIP_5005Parser = createCentralita_VOIPIP_5005Parser();
		}
		return centralita_VOIPIP_5005Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createCentralita_VOIPIP_5005Parser() {
		EAttribute[] features = new EAttribute[] { TelcoblocksPackage.eINSTANCE
				.getServidor_IP(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser telefono_VOIPID_5006Parser;

	/**
	 * @generated
	 */
	private IParser getTelefono_VOIPID_5006Parser() {
		if (telefono_VOIPID_5006Parser == null) {
			telefono_VOIPID_5006Parser = createTelefono_VOIPID_5006Parser();
		}
		return telefono_VOIPID_5006Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createTelefono_VOIPID_5006Parser() {
		EAttribute[] features = new EAttribute[] { TelcoblocksPackage.eINSTANCE
				.getTerminal_ID(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser enlaceComentario_6001Parser;

	/**
	 * @generated
	 */
	private IParser getEnlaceComentario_6001Parser() {
		if (enlaceComentario_6001Parser == null) {
			enlaceComentario_6001Parser = createEnlaceComentario_6001Parser();
		}
		return enlaceComentario_6001Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createEnlaceComentario_6001Parser() {
		EAttribute[] features = new EAttribute[] { TelcoblocksPackage.eINSTANCE
				.getEnlace_Comentario(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	protected IParser getParser(int visualID) {
		switch (visualID) {
		case SoftPhone_VOIPIDEditPart.VISUAL_ID:
			return getSoftPhone_VOIPID_5001Parser();
		case Servidor_VOIPIPEditPart.VISUAL_ID:
			return getServidor_VOIPIP_5002Parser();
		case MediaServerIPEditPart.VISUAL_ID:
			return getMediaServerIP_5003Parser();
		case Servidor_APP_SIPIPEditPart.VISUAL_ID:
			return getServidor_APP_SIPIP_5004Parser();
		case Centralita_VOIPIPEditPart.VISUAL_ID:
			return getCentralita_VOIPIP_5005Parser();
		case Telefono_VOIPIDEditPart.VISUAL_ID:
			return getTelefono_VOIPID_5006Parser();
		case EnlaceComentarioEditPart.VISUAL_ID:
			return getEnlaceComentario_6001Parser();
		}
		return null;
	}

	/**
	 * @generated
	 */
	public IParser getParser(IAdaptable hint) {
		String vid = (String) hint.getAdapter(String.class);
		if (vid != null) {
			return getParser(TelcoblocksVisualIDRegistry.getVisualID(vid));
		}
		View view = (View) hint.getAdapter(View.class);
		if (view != null) {
			return getParser(TelcoblocksVisualIDRegistry.getVisualID(view));
		}
		return null;
	}

	/**
	 * @generated
	 */
	public boolean provides(IOperation operation) {
		if (operation instanceof GetParserOperation) {
			IAdaptable hint = ((GetParserOperation) operation).getHint();
			if (TelcoblocksElementTypes.getElement(hint) == null) {
				return false;
			}
			return getParser(hint) != null;
		}
		return false;
	}

	/**
	 * @generated
	 */
	public static class HintAdapter extends ParserHintAdapter {

		/**
		 * @generated
		 */
		private final IElementType elementType;

		/**
		 * @generated
		 */
		public HintAdapter(IElementType type, EObject object, String parserHint) {
			super(object, parserHint);
			assert type != null;
			elementType = type;
		}

		/**
		 * @generated
		 */
		public Object getAdapter(Class adapter) {
			if (IElementType.class.equals(adapter)) {
				return elementType;
			}
			return super.getAdapter(adapter);
		}
	}

}
